package cn.nawang.ebeim.client.version;

/**
 * Created by GanJc on 2016/2/25.
 */
public class PalindromeNumber {

    public static void main(String[] args) {
//        System.out.println(isPalindrome(-1));
//        System.out.println(isPalindrome(0));
//        System.out.println(isPalindrome(1));
//        System.out.println(isPalindrome(2));
//        System.out.println(isPalindrome(11));
//        System.out.println(isPalindrome(121));
//        System.out.println(isPalindrome(122));
        System.out.println(isPalindrome(14444441));
        System.out.println(isPalindrome(14445561));
    }
    public static boolean isPalindrome(int x) {
        if(x<0){
            return false;
        }
        if(0<=x&&x<10){
            return true ;
        }
        int tmp = x;
        int y = 0;
        while (x != 0) {
            y = y * 10 + x % 10;
            x = x / 10;
        }
        if (y == tmp){
            return true;
        }else{
            return false;
        }
    }
}
